﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class ShowPhoneCamera : MonoBehaviour {

    private WebCamTexture cameraTexture;
    private string cameraName = "";

    void Start()
    {
        WebCamDevice[] devices = WebCamTexture.devices;
        cameraName = devices[0].name;
        cameraTexture = new WebCamTexture(cameraName, Screen.width, Screen.height, 120);
        cameraTexture.Play();
        GetComponent<RawImage>().texture = cameraTexture;
        GetComponent<RectTransform>().sizeDelta = new Vector2(Screen.height, Screen.width);
    }
}
